﻿<UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="SuperLauncher.Views.JumpListItemsTreeView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewmodels="clr-namespace:SuperLauncher.ViewModels"
    xmlns:toolkitContorls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"  
    xmlns:controls="clr-namespace:SuperLauncher.Controls"
    xmlns:sl8="http://www.sl8.so"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" Margin="0">
    <UserControl.Resources>
        <viewmodels:JumpListItemsTreeViewModel x:Key="jumpListItemsTreeViewModelInstance"/>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" AllowDrop="True" DataContext="{StaticResource  jumpListItemsTreeViewModelInstance}">
        <sl8:AppChromeControl sl8:MainWindowDragMoveService.IsDragMove="True" Title="便捷启动器" Background="#FF4A7300" AppIconImageSource="/SuperLauncher;component/Assets/layers_appicon.png">
            <Border Margin="1" BorderThickness="1" BorderBrush="Black">
                <Grid  Background="White">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <ListBox ItemsSource="{Binding Path=CategoryInfos}"  ScrollViewer.VerticalScrollBarVisibility="Visible" BorderThickness="1" HorizontalAlignment="Stretch" Margin="8,8,30,8" >
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <ContentPresenter/>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </ListBox.ItemContainerStyle>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <TextBox Text="{Binding Path=Title, Mode=TwoWay}" VerticalAlignment="Center" Foreground="#FF1A3879" />
                                        <Border Height="1" Grid.Column="1" Background="#FF721919"  HorizontalAlignment="Stretch" Margin="6,0,8,0" />
                                        <HyperlinkButton Grid.Column="2" CommandParameter="{Binding}" Content="Delete" Margin="6,0" VerticalAlignment="Center" Command="{Binding Path=DataContext.DeleteCategoryCommand, ElementName=LayoutRoot}" />
                                    </Grid>
                                    <toolkitContorls:ListBoxDragDropTarget  HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.Row="1" AllowDrop="True">
                                        <ListBox MinHeight="60" MinWidth="120" Margin="30,5,16,5" ItemsSource="{Binding Path=Items}" HorizontalAlignment="Stretch">
                                            <ListBox.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <StackPanel Orientation="Vertical"></StackPanel>
                                                </ItemsPanelTemplate>
                                            </ListBox.ItemsPanel>
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <Grid MinWidth="320"  HorizontalAlignment="Stretch">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition Width="*"/>
                                                            <ColumnDefinition Width="Auto"/>
                                                            <ColumnDefinition Width="Auto"/>
                                                        </Grid.ColumnDefinitions>
                                                        <TextBlock Grid.Column="0" Margin="3" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Title}"/>
                                                        <HyperlinkButton Grid.Column="1" CommandParameter="{Binding}" Content="Edit" Margin="6,0" VerticalAlignment="Center" Command="{Binding Path=DataContext.EditCommand, ElementName=LayoutRoot}" />
                                                        <HyperlinkButton Grid.Column="2" CommandParameter="{Binding}" Content="Delete" Margin="6,0" VerticalAlignment="Center" Command="{Binding Path=DataContext.DeleteCommand, ElementName=LayoutRoot}" />
                                                    </Grid>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>
                                    </toolkitContorls:ListBoxDragDropTarget>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    <StackPanel Orientation="Horizontal"  HorizontalAlignment="Center" Grid.Row="1" Margin="8">
                        <Button Content="添加..." Margin="12,0" Command="{Binding Path=NewJumpListItemCommand}"/> 
                        <Button Content="取消" Margin="12,0" Command="{Binding Path=CancelCommand}" />
                    </StackPanel>
                </Grid>
            </Border>
        </sl8:AppChromeControl>
    </Grid>
</UserControl>
